package learn.atshanguigu.network.http;

import okhttp3.OkHttpClient;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.http.HttpClient;

/**
 * @AUTHOR LYF
 * @DATE 2022/5/12
 * @VERSION 1.0
 * @DESC
 */
public class HttpClientDemo {
    public static void main(String[] args) throws IOException {
        HttpClient client = HttpClient.newHttpClient();
        HttpURLConnection httpURLConnection = new HttpURLConnection(new URL("http://www.badidu.com")) {
            @Override
            public void connect() throws IOException {
                System.out.println("connection....");
            }

            @Override
            public void disconnect() {

            }

            @Override
            public boolean usingProxy() {
                return true;
            }
        };
        //System.out.println(httpURLConnection.getContent());
        //OkHttp
        //System.out.println(httpURLConnection.getResponseCode());
       InputStream inputStream =  httpURLConnection.getInputStream();
       byte[] buffer = new byte[1024];
       inputStream.read(buffer);

        OkHttpClient httpClient = new OkHttpClient();


    }
}
